﻿// SyntheticDataGenerator.ParameterSets.SequenceParameters
//
// (c) 2011 Arthur Pitman
//
// Part of Market-Basket Synthetic Data Generator
// A C# adaptation of the IBM Quest Market-Basket Synthetic Data Generator
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// (Version 2) as published by the Free Software Foundation.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public
// License (Version 2) along with this program; if not, write to 
// the Free Software Foundation, Inc., 
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// or see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace SyntheticDataGenerator.ParameterSets
{
    /// <summary>
    /// Sequence parameters
    /// </summary>
    public class SequenceParameters : CreatorParameters
    {        
        /// <summary>
        /// number of customers in database
        /// </summary>
        public int SequenceCount { get; set; }
        
        /// <summary>
        /// Average sequence length
        /// </summary>
        public double AverageSequenceLength { get; set; }
        
        /// <summary>
        /// Parameters for potentially large sequences 
        /// </summary>
        public PatternParameters LSeqParameters { get; set; }	
        
        /// <summary>
        /// Flag to write flat sequences, e.g. 1, 2, 3; 4, 5; 6
        /// </summary>
        public bool FlatSequences { get; set; }

        /// <summary>
        /// Initializes a new <see cref="SequenceParameters"/> instance with default values
        /// </summary>
        public SequenceParameters()
        {
            SequenceCount = 100000;
            AverageSequenceLength = 10;            
            FlatSequences = false;

            LSeqParameters = new PatternParameters();
            LSeqParameters.PatternCount = 5000;
            LSeqParameters.AverageLength = 4.0;

            AverageTransactionLength = 2.5;
            ItemCount = 10000;

            LisParameters.PatternCount = 25000;            
            LisParameters.AverageLength = 1.25;
        }

        /// <summary>
        /// Writes parameters to a <see cref="TextWriter"/>
        /// </summary>
        /// <param name="writer"></param>
        public override void Write(TextWriter writer)
        {
            writer.WriteLine("SequenceCount={0}, AverageSequenceLength={1}", SequenceCount, AverageSequenceLength);
            writer.WriteLine("FlatSequences={0}", FlatSequences);
            writer.WriteLine("Sequence Patterns:");
            LSeqParameters.Write(writer);
            base.Write(writer);           
        }
    }
}
